import java.util.Arrays;
import java.util.Scanner;

public class LunZhuanTest {
    public static void main(String[] args) {
        int k = 0;
        Scanner sc = new Scanner(System.in);
        for (int i = 0;  ; i++) {

             k = sc.nextInt();
            if(k>0){
                break;
            }
        }
      int [] num ={1,2,3,4,5,6,7};
        for (int j = 0; j <k; j++) {
            int change = 0;
            change = num[0];
            for (int i = 0; i < num.length-1; i++) {
                num[i] = num[i + 1];
            }
            num[num.length-1] =change;
            }
        System.out.println(Arrays.toString(num));
        }

}
